package com.soft.dao;

import com.soft.IBaseDao.IBaseDao;
import com.soft.pojo.Position;
import com.soft.utils.DBUtil;

import java.util.List;

/**
 * @author ruoxi
 * @create 2021-12-26 20:42
 */
public class PositionDaoImpl implements IBaseDao<Position> {
    @Override
    public int add(Position var1) {
        return DBUtil.excute("insert into position values(?,?,?,?,?,?,?,?,?)", null,var1.getGname(),var1.getGwzz(),var1.getNum(),var1.getAsk(),var1.getSuperior(),var1.getSubordinates(),var1.getWages(),0);
    }

    @Override
    public int del(int var1) {
        return 0;
    }

    @Override
    public int update(Position var1) {
        return 0;
    }

    @Override
    public List<Position> selectByAll() {
        return DBUtil.query("select * from position", Position.class);
    }

    @Override
    public Position selectByKey(Position var1) {
        return null;
    }

    public List<Position> selectPositionByPage(int currentPage,int currentCount){
        return DBUtil.query("select * from position limit ?,?", Position.class, currentPage,currentCount);
    }

    public Position selectPositionById(int id){
        List<Position> positions = DBUtil.query("select * from position where id = ?", Position.class, id);
        return positions.get(0);
    }
}
